home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
c_lib.arc
/
PCRETVEC.C
< prev
next >
Wrap
Text File
|
1990-08-09
|
2KB
|
56 lines
/**
*
* Name pcretvec -- Return interrupt vector
*
* Synopsis ercode = pcretvec(intype,pvector);
* int ercode Error return code
* int intype Interrupt type number
* ADS *pvector Interrupt vector
*
* Description This function returns the interrupt vector associated
* with the specified interrupt type. The CS:IP vector is
* returned in the segment:offset components of *pvector.
*
* Returns ercode If intype is not in the range 0 to 255
* 1 is returned; otherwise 0.
* pvector Interrupt vector (CS:IP address of
* of interrupt handling routine).
*
* Version 1.0 (C)Copyright Blaise Computing Inc. 1983
*
**/
#define utbyword(a,b) (((a)<<8)|((b)&0x00ff)) /* a is high, b low */
#define utoutrng(a,l,h) (((a)<(l)||(a)>(h))?1:0) /* Is a out of range? */
struct segads /* Offset, segment address type */
{
unsigned r;
unsigned s;
};
#define ADS struct segads /* Abbreviation */
struct dreg
{
unsigned ax,bx,cx,dx,si,di,ds,es;
};
#define DOSREG struct dreg
int pcretvec(intype,pvector)
int intype;
ADS *pvector;
{
DOSREG dos_reg;
if (utoutrng(intype,0,255))
return(1);
utinit(&dos_reg); /* Initialize registers */
dos_reg.ax = utbyword(0x35,intype);
dos(&dos_reg);
pvector->s = dos_reg.es;
pvector->r = dos_reg.bx;
return(0);
}